home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 2 / AACD 2.iso / AACD / Magazine / GraphicsCards / StormMesa / src / context.h < prev    next >
C/C++ Source or Header  |  1999-02-04  |  4KB  |  157 lines

  1. /* $Id: context.h,v 3.1 1998/02/13 03:17:02 brianp Exp $ */
  2.  
  3. /*
  4.  * Mesa 3-D graphics library
  5.  * Version:  3.0
  6.  * Copyright (C) 1995-1998  Brian Paul
  7.  *
  8.  * This library is free software; you can redistribute it and/or
  9.  * modify it under the terms of the GNU Library General Public
  10.  * License as published by the Free Software Foundation; either
  11.  * version 2 of the License, or (at your option) any later version.
  12.  *
  13.  * This library is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16.  * Library General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU Library General Public
  19.  * License along with this library; if not, write to the Free
  20.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  */
  22.  
  23.  
  24. /*
  25.  * $Log: context.h,v $
  26.  * Revision 3.1  1998/02/13 03:17:02  brianp
  27.  * added basic stereo support
  28.  *
  29.  * Revision 3.0  1998/01/31 20:49:07  brianp
  30.  * initial rev
  31.  *
  32.  */
  33.  
  34.  
  35. #ifndef CONTEXT_H
  36. #define CONTEXT_H
  37.  
  38. #include "types.h"
  39.  
  40. #ifdef THREADS
  41.    /*
  42.     * A seperate GLcontext for each thread
  43.     */
  44.    extern GLcontext *gl_get_thread_context( void );
  45. #else
  46.    /*
  47.     * All threads use same pointer to current context.
  48.     */
  49.    extern GLcontext *CC;
  50. #endif
  51.  
  52.  
  53.  
  54. /*
  55.  * There are three Mesa datatypes which are meant to be used by device
  56.  * drivers:
  57.  *   GLcontext:  this contains the Mesa rendering state
  58.  *   GLvisual:  this describes the color buffer (rgb vs. ci), whether
  59.  *              or not there's a depth buffer, stencil buffer, etc.
  60.  *   GLframebuffer:  contains pointers to the depth buffer, stencil
  61.  *                   buffer, accum buffer and alpha buffers.
  62.  *
  63.  * These types should be encapsulated by corresponding device driver
  64.  * datatypes.  See xmesa.h and xmesaP.h for an example.
  65.  *
  66.  * In OOP terms, GLcontext, GLvisual, and GLframebuffer are base classes
  67.  * which the device driver must derive from.
  68.  *
  69.  * The following functions create and destroy these datatypes.
  70.  */
  71.  
  72.  
  73. /*
  74.  * Create/destroy a GLvisual.  A GLvisual is like a GLX visual.  It describes
  75.  * the colorbuffer, depth buffer, stencil buffer and accum buffer which will
  76.  * be used by the GL context and framebuffer.
  77.  */
  78. extern GLvisual *gl_create_visual( GLboolean rgbFlag,
  79.                    GLboolean alphaFlag,
  80.                    GLboolean dbFlag,
  81.                    GLboolean stereoFlag,
  82.                    GLint depthBits,
  83.                    GLint stencilBits,
  84.                    GLint accumBits,
  85.                    GLint indexBits,
  86.                    GLint redBits,
  87.                    GLint greenBits,
  88.                    GLint blueBits,
  89.                    GLint alphaBits );
  90.  
  91. extern void gl_destroy_visual( GLvisual *vis );
  92.  
  93.  
  94. /*
  95.  * Create/destroy a GLcontext.  A GLcontext is like a GLX context.  It
  96.  * contains the rendering state.
  97.  */
  98. extern GLcontext *gl_create_context( GLvisual *visual,
  99.                      GLcontext *share_list,
  100.                      void *driver_ctx,
  101.                      GLboolean direct);
  102.  
  103. extern void gl_destroy_context( GLcontext *ctx );
  104.  
  105.  
  106. /*
  107.  * Create/destroy a GLframebuffer.  A GLframebuffer is like a GLX drawable.
  108.  * It bundles up the depth buffer, stencil buffer and accum buffers into a
  109.  * single entity.
  110.  */
  111. extern GLframebuffer *gl_create_framebuffer( GLvisual *visual );
  112.  
  113. extern void gl_destroy_framebuffer( GLframebuffer *buffer );
  114.  
  115.  
  116.  
  117. extern void gl_make_current( GLcontext *ctx, GLframebuffer *buffer );
  118.  
  119. extern GLcontext *gl_get_current_context(void);
  120.  
  121. extern void gl_copy_context(const GLcontext *src, GLcontext *dst, GLuint mask);
  122.  
  123. extern void gl_set_api_table( GLcontext *ctx, const struct gl_api_table *api );
  124.  
  125.  
  126.  
  127. /*
  128.  * GL_MESA_resize_buffers extension
  129.  */
  130. extern void gl_ResizeBuffersMESA( GLcontext *ctx );
  131.  
  132.  
  133.  
  134. /*
  135.  * Miscellaneous
  136.  */
  137.  
  138. extern void gl_problem( const GLcontext *ctx, const char *s );
  139.  
  140. extern void gl_warning( const GLcontext *ctx, const char *s );
  141.  
  142. extern void gl_error( GLcontext *ctx, GLenum error, const char *s );
  143.  
  144. extern GLenum gl_GetError( GLcontext *ctx );
  145.  
  146.  
  147. extern void gl_update_state( GLcontext *ctx );
  148.  
  149.  
  150.  
  151. #ifdef PROFILE
  152. extern GLdouble gl_time( void );
  153. #endif
  154.  
  155.  
  156. #endif
  157.